package cn.wps.moffice.demo.menu;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.os.Bundle;
import android.util.SparseArray;
import android.widget.ExpandableListView;
import cn.wps.moffice.demo.R;
import cn.wps.moffice.demo.util.SettingPreference;

/**
 * @author ：chenyunbiao
 */
public class ParamActivity extends Activity {
	
	SettingPreference preference;
	ExpandableListView exListView;
	ExListAdapter exAdaper;
	private List<Groups> groups;
	private SparseArray<List<Child>> childs;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_expand);
		initDatas();
		exListView = (ExpandableListView) findViewById(R.id.expandView);
		exAdaper = new ExListAdapter(ParamActivity.this, groups, childs);
		exListView.setAdapter(exAdaper);
		exListView.expandGroup(0);
	}
	
	private void initDatas() {
		groups = new ArrayList<Groups>();
		groups.add(new Groups("打开文档的模式及界面"));
		groups.add(new Groups("常用参数"));
		groups.add(new Groups("限制编辑参数"));
		
		List<Child> childs1 = new ArrayList<Child>();
		Child childData1 = new Child("打开文档的模式", "自动选择", false);
		childs1.add(childData1);
		Child childData2 = new Child("显示自定义菜单界面", "是否以自定义菜单界面来操作", true);
		childs1.add(childData2);
		Child childData3 = new Child("显示文档界面", "是否显示wps界面来操作", true);
		childs1.add(childData3);
		
		List<Child> childs2 = new ArrayList<Child>();
		Child childData4 = new Child("文件保存广播", "保存文件时是否发送广播", true);
		childs2.add(childData4);
		Child childData5 = new Child("文件关闭广播", "关闭文件时是否发送广播", true);
		childs2.add(childData5);
		Child childData6 = new Child("以修订模式打开", "打开文档是否自动进入修订模式", true);
		childs2.add(childData6);
		
		List<Child> childs3 = new ArrayList<Child>();
		Child childData7 = new Child("保存", "是否允许保存", true);
		childs3.add(childData7);
		Child childData8 = new Child("复制", "是否允许复制", true);
		childs3.add(childData8);
		Child childData9 = new Child("共享", "是否允许共享", true);
		childs3.add(childData9);
		
		childs = new SparseArray<List<Child>>();
		childs.put(0, childs1);
		childs.put(1, childs2);
		childs.put(2, childs3);
	}
	
}
